
iload = 1;
if (iload==0)
    n     =  2; % number of countries
    ns      =  1;
    beta   = 1/(1+0.1);     % discount factor
    theta  = 2;
    sigma = 0;
    gL      = 0.02;
    dbar   = 1.1;
    delta = 1-1/(1+gL);

    rhoa   = 0.95;
    std_ea = 0.1;

    rhod   = 0.99;
    std_ed = 0.05;


    L = ones(n,1);
    alpha = [1;0.9];
end

rho   = beta*(1-delta);
rbest = delta/(theta*(1-beta*(1-delta))+delta);


%%%%%%%%%% Don't change the above code %%%%%%%%%%%
global theta dbar  L gL alpha rbest rho sigma ns n betas d ilog_rL delta beta

% private eqm
r_private = rbest;
n  = ncountries;
ns = nsectors;
ilog_rL = 1; % use exp(rL)/(1+exp(rL))

dij = dbar;
d=dij*ones(n); %dij is (1+iceberg) cost producing in j selling to i
d=d-(dij-1)*eye(n);


%% solve for the steady state of gov assuming dG2/dT=0!!!
% This is not the true steady state, it's only for us to get initial guess
% --- steady state ---


options = optimoptions('fsolve', 'TolFun', 1e-12);
options.Display = 'off';

xguess(1:2) = 1.1;
xguess(3) = 0.2;

[xval,fval_sol,eflag_ss] = fsolve(@(xval) solve_1s_2c_gov_ss_nogL(xval),xguess,options); %iter


[Tss,xss,Pss,pi_ss, fval_ss] = eval_1s_2c_gov_ss_nogL(xval);

xval_ss= xval;
wss = xval(1:n);
extax_ss = xval(3);
taf_ss = 0;
rss = rbest;
lrss = log(rbest);

riskfree_ss = 1/beta;
rmul_ss = (1+theta*pi_ss(2,2))/(1+extax_ss)-theta*pi_ss(2,2);

% exp(riskfree2)  = exp(x2)^(-sigma1)*exp(P2)^(1-sigma1)/(betad*exp(x2(+1))^(-sigma1)*exp(P2(+1))^(1-sigma1));
% 
% //sa1 = rhoa*sa1(-1)+std_ea*ea1;
% //sa2 = rhoa*sa2(-1)+std_ea*ea2;
% 
% rmul = (1+theta1*pi22)/(1+taux)-theta1*pi22;


